package com.io.testHttp;

import cn.hutool.core.lang.Console;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;

/**
 * @author keyer
 * @Description : 描述
 * Created by cyd on 2021-04-13 16:39:59
 */
public class TestHttpResponse {
    String url = "http://www.baidu.com";

    public void test01() {
        HttpResponse res = HttpRequest.post(url).execute();
        Console.log(res.getStatus());
    }

    public void test02() {
        HttpResponse res = HttpRequest.post(url).execute();
        //预定义的头信息
        Console.log(res.header(Header.CONTENT_ENCODING));
        //自定义头信息
        Console.log(res.header("Content-Disposition"));
    }

    public static void main(String[] args) {
        new TestHttpResponse().test02();
    }
}
